<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
		<meta name="format-detection" content="telephone=no">
		<link href="fonts/font-awesome.min.css" rel="stylesheet" />
		<link href="css/mobile-select-date.css" rel="stylesheet" />
		<link href="css/jquery.mloading.css" rel="stylesheet" />
		<link href="css/common.css?v=123" rel="stylesheet" />
		<link href="css/carInsurancePrice.css" rel="stylesheet" />
		<link href="css/chooseCarInsurance.css" rel="stylesheet" />
		<title>e车险保</title>
		<style type="text/css">
			.hide {
				display: none !important;
			}
			
			#insuranceDetail .button {
				margin-top: 1.82rem;
				margin-bottom: 1.82rem;
			}
			
			#insuranceDetail input {
				font-size: 1.364rem;
				color: #0081CC !important;
			}
			
			#insuranceDetail input[type='button'] {
				color: #fff !important;
				font-size: 1.45rem !important;
			}
			
			#insuranceDetail input[type='datetime'] {
				color: #333;
			}
			/* .left img.question-icon{
            margin-top:-4rem;
        }*/
			
			#modifyInsurance .box .item .left {
				text-align: left;
				width: auto;
				overflow: visible;
			}
			
			#insuranceDetail .box .item .left.my-left {
				flex: 1;
				-webkit-flex: 1;
			}
			
			#modifyInsurance .box .item .left span {
				display: inline-block;
				width: 11rem;
				white-space: nowrap;
				text-overflow: ellipsis;
				-o-text-overflow: ellipsis;
				overflow: hidden;
				vertical-align: middle;
			}
			
			.modal .body {
				margin: 1.64rem;
				background: #fff;
			}
			
			.modal .body .content {
				position: absolute;
				top: 2rem;
				left: 0;
				right: 0;
				/*bottom:0;*/
				/*overflow: auto;*/
				padding: 0 1.82rem;
			}
			
			.modal .body .head {
				height: 1.82rem;
				line-height: 1.82rem;
				margin-top: 0.91rem;
				margin-right: 0.91rem;
			}
			
			.modal .body .head img {
				height: 1.82rem;
				float: right;
			}
			
			.modal .body {
				top: 0;
			}
			
			.content h1,
			h2 {
				margin: 10px 0;
			}
			
			h2 {
				color: #0081CC;
			}
			
			.content p {
				line-height: 18px;
				font-size: 16px;
			}
			
			#insuranceDetail .box .item .left {
				flex: 3;
				-webkit-flex: 3;
			}
		</style>
	</head>

	<body class="bacc">
		<div id="insurance-app" v-cloak>
			<!--报价详情begin-->
			<div id="carInfo" v-if="carInfo.insurance">
				<div class="top-title">
					<div class="nav-left" @click="backCar"><i class="fa fa-angle-left" aria-hidden="true"></i></div>
					车险报价
					<div class="nav-right" @click="back"><img src="images/write.png" alt="">选择险种</div>
				</div>
				<div class="box-box">
					<div class="car-info">
						<div class="license">车牌：<span v-if="carInfo.licenseNo">{{carInfo.licenseNo}}</span>
							<div style="float:right;margin-right: 1.36rem;color:#0081CC;" id="modifyCarInfo" @click="toModifyCarInfo"><img src="images/write.png" alt="" style="width:1.64rem">信息不对</div>
						</div>
						<div class="type">车型：<span v-if="carInfo.carMode">{{carInfo.carMode[0]}}</span>
						</div>
					</div>
					<div class="price">
						<div class="item" v-for="item in carInfo.insurance.data" v-if="carInfo.insurance.data">
							<div class="title">
								<div class="company">
									<img class="logo" :src="'http://ydche.com/media/mcimg/'+item.imageName"> {{insurer[item.quoteResult.insurerCode]}} <span style="color:#fff;background:#D43C33;padding:0 0.2rem;font-size:1.1rem; " class="hide">券</span>
									<img class="mark" src="images/xu.png" v-show="item.IsRenewal">
								</div>
								<div class="detail" @click="showDetail(item.quoteResult.CoverageList,item.quoteResult.biBeginDate,item.quoteResult.ciBeginDate,item.quoteResult.carshipTax,item.quoteResult.insurerCode,item.disCount)">
									<input type="button" value="查看详情" id="detail">
								</div>
							</div>
							<div class="content">
								<div class="basic">
									交强险+车船税：<span>{{parseFloat(item.quoteResult.ciPremium) + parseFloat(item.quoteResult.carshipTax)}}元</span>
									<span class="total" style="float:right;">¥ {{(parseFloat(item.quoteResult.ciPremium) + parseFloat(item.quoteResult.carshipTax) + parseFloat(item.quoteResult.biPremium)).toFixed(2)}}起</span>
								</div>
								<div class="other">
									商业险：<span>{{parseFloat(item.quoteResult.biPremium)}}元</span>
									<span class="total" style="color:#D43C33;font-size:1.273rem;"><img src="images/count.gif" alt="" style="width:1.3rem;margin-top: -0.3rem;"> ¥ {{item.disCount}}起</span>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!--报价详情end-->

			<!--修改保险信息begin-->
			<div class="hide">{{insurancetypes}}</div>
			<div id="modifyInsurance" class="hide" @click="hideText()" v-if="insurancetypes">
				<div class="top-title">
					<div class="nav-left" @click="toBackType"><i class="fa fa-angle-left" aria-hidden="true"></i></div>
					修改信息
				</div>
				<div class="box-box">
					<div class="box">
						<div class="title-box">
							<div class="title">交强险</div>
						</div>
						<div class="item">
							<div class="left">注册日期</div>
							<div class="right has-icon" id="register-date"><input type="date" placeholder="请输入注册日期" v-model="insurance.ciBeginDate">
								<!--<i class="fa fa-angle-right" aria-hidden="true"></i>--></div>
						</div>
					</div>
					<div class="box" v-if="insurancetypes">
						<div class="title-box">
							<div class="title">商业险</div>
						</div>
						<div class="item">
							<div class="left">保险起期</div>
							<div class="right has-icon" id="beginDate"><input type="date" placeholder="请输入保险起期" v-model="insurance.biBeginDate">
								<!--<i class="fa fa-angle-right" aria-hidden="true"></i>--></div>
						</div>
						<div class="item" v-for="insuranceType in insurancetypes" v-show="insuranceType.show">
							<div class="left"><span @click="showText(event.currentTarget,insuranceType.riskName)">{{insuranceType.riskName}}</span>

								<img class="question-icon" src="images/question@3x.png" alt="" @click="showInsuranceDefine(insuranceType.riskCode)" v-show="insuranceType.riskCode != 'Z3'">
							</div>
							<!--insuranceVm.insurance.insurance['M'+insurancetypes[0].riskCode]-->
							<div class="middle" v-if="!insurance.insurance['M'+insuranceType.riskCode]">

							</div>
							<div class="middle" v-show="insurance.insurance[insuranceType.riskCode].selected != ''" v-else>
								<div class="hide">{{insurance.insurance['M'+insuranceType.riskCode].flag}}</div>
								<div class="chec-one">
									<input type="checkbox" value="1" :id="insuranceType.riskCode" name="" class="hide" v-model="insurance.insurance['M'+insuranceType.riskCode].flag" />
									<label :for="insuranceType.riskCode" @click="changeLable(insuranceType.riskCode)"></label>
								</div>
								<span v-if="insuranceType.riskCode != 'F'">不计免赔</span>
								<span v-else>进口玻璃</span>
							</div>
							<div class="right has-icon">
								<div class="hide">{{insurance.insurance[insuranceType.riskCode].selected}}</div>
								<select v-model="insurance.insurance[insuranceType.riskCode].selected" @change="test(insurance.insurance[insuranceType.riskCode].selected,insuranceType.riskCode)">
									<option :value="(item == '投保')?'Y' : ((item == '不投保')?'':item)" v-for="item in insuranceType.insuredAmount">{{ isNaN(parseInt(item)) ? item: ((parseInt(item) % 10000==0) ? (parseInt(item)/10000) + '万':item )}}</option>
								</select>
								<i class="fa fa-angle-right" aria-hidden="true"></i>
							</div>
						</div>
					</div>
					<div class="button">
						<input type="button" value="下一步" id="to-next" @click="toNext">
					</div>
				</div>
			</div>
			<!--修改保险信息end-->

		</div>

		<!--保险详情begin-->
		<div id="insuranceDetail" class="hide" v-if="insurerDetail" v-cloak>
			<div class="top-title">
				<div class="nav-left" @click="toBack"><i class="fa fa-angle-left" aria-hidden="true"></i></div>
				保费详情
			</div>
			<div class="box-box">
				<div class="box">
					<div class="title-box">
						<div class="title">交强险</div>
					</div>
					<div class="item">
						<div class="left">注册日期</div>
						<div class="right"><input type="datetime" :value="insurerDetail ? insurerDetail['ciBeginDate'] :''" readonly></div>
					</div>
					<div class="item">
						<div class="left">交强险</div>
						<div class="right"><input type="text" :value="insurerDetail['FORCEPREMIUM'] ? insurerDetail['FORCEPREMIUM']['insuredPremium'] : ''" readonly></div>
					</div>
					<div class="item">
						<div class="left">车船税</div>
						<div class="right"><input type="text" :value="insurerDetail ? insurerDetail['carshipTax'] : ''" readonly></div>
					</div>
				</div>
				<div class="box">
					<div class="title-box">
						<div class="title">商业险</div>
					</div>
					<div class="item">
						<div class="left">保险起期</div>
						<div class="right"><input type="datetime" :value="insurerDetail['biBeginDate']" readonly></div>
					</div>

					<div class="item" v-for="item in insurerDetail.insurance">
						<div class="left" :title="item.coverageName">{{item.coverageName}}</div>
						<div class="middle">{{item.insuredAmount}}</div>
						<div class="right" v-show="item.insuredAmount != ''"><input type="text" v-model="item.insuredPremium" readonly></div>
					</div>
					<div class="item">
						<div class="left my-left">总金额</div>
						<div class="right"><input type="text" :value="'¥'+ insurerDetail.total" readonly></div>
					</div>
					<div class="item">
						<div class="left my-left">优惠金额</div>
						<div class="right"><input type="text" :value="'- ¥'+ insurerDetail.disCount" readonly style="font-size: 1.82rem;color: #D0011B!important;"></div>
					</div>
					<div class="item">
						<div class="left my-left">实付金额</div>
						<div class="right"><input type="text" :value="'¥'+ (insurerDetail.total - insurerDetail.disCount).toFixed(2)" readonly></div>
					</div>
				</div>
				<div class="button">
					<input type="button" value="去购买" id="to-pay" @click="toAccurate(insurerDetail.insuranceCode)">
				</div>
			</div>
		</div>
		<!--保险详情end-->

		<div class="modal hide">
			<div class="body">
				<div class="head">
					<img src="images/close.png" class="close">
				</div>
				<div class="content">

				</div>
			</div>
		</div>
		<div class="mask hide"></div>
		<div class="alert"></div>
		<div class="text">
			<span></span>
			<div class="arrow"></div>
		</div>
	</body>

</html>
<script src="js/jquery-1.11.2.js"></script>
<script src="js/dialog.js"></script>
<script src="js/mobile-select-date.js"></script>
<script src="js/vue.min.js"></script>
<script src="js/jquery.mloading.js"></script>
<script src="js/common.js"></script>
<script>
	$("#detail").click(function() {
		window.location.href = "carInsurancePriceDetail.html";
	});
	var insuranceVm;
	// var insurancetypes = JSON.parse(localStorage.getItem("insurancetypes"));

	var YDSF = JSON.parse(localStorage.getItem("YDSF"));
	var insurancetypes = YDSF.insurancetypes;
	
	$(function() {

		//        var is_new = localStorage.getItem("YDSF_isNew");
		//        if(is_new == "true"){
		//            $("#modifyInsurance").removeClass("hide");
		//        }

		//保费
		var insuranceDetailVm = new Vue({
			el: "#insuranceDetail",
			data: {
				insurerDetail: {}
			},
			methods: {
				toBack: function() {
					$("#insuranceDetail").addClass("hide");
					$("#carInfo").show();
				},
				toAccurate: function(code) {
					//localStorage.setItem("insuranceCode",code);

					var YDSF = JSON.parse(localStorage.getItem("YDSF"));
					YDSF.insuranceCode = code;
					localStorage.setItem("YDSF", JSON.stringify(YDSF));

					window.location.href = "carOwerInfo.html";
				}
			}
		});

		myInsurancetypes = getInsuranceTypes(insurancetypes);
		console.log(myInsurancetypes)
		console.log(myInsurancetypes.constructor.name)
		
		//console.log(insurance.insurance[insuranceType.riskCode])
		//保额
		insuranceVm = new Vue({
			el: "#insurance-app",
			data: {
				insurance: {},
				carInfo: {
					licenseNo: localStorage.getItem("YDSF_licenseNo"),
					carMode: []
				},
				//insurer:insurer,
				insurancetypes: myInsurancetypes
			},
			methods: {
				toModifyCarInfo: function() {
					//                    $("#carInfo").hide();
					//                    $("#my-car").removeClass("hide");
					window.location.href = "newCar.html";
				},
				backCar: function() {
					history.back(-1);
				},
				back: function() {
					$("#carInfo").hide();
					$("#modifyInsurance").removeClass("hide");
				},
				toBackCar: function() {
					$("#my-car").addClass("hide");
					$("#carInfo").show();
				},
				toBackType: function() {
					$("#modifyInsurance").addClass("hide");
					$("#carInfo").show();
				},
				toNext: function() {
					if(insuranceVm.insurance.ciBeginDate == "") {
						popInfo("交强险注册日期不能为空");
						return;
					}
					var my_flag, index;
					var data = {};
					data.biBeginDate = insuranceVm.insurance.biBeginDate;
					data.licenseNo = insuranceVm.carInfo.licenseNo;
					data.ciBeginDate = insuranceVm.insurance.ciBeginDate;
					data.coverageList = [];
					var insurance = insuranceVm.insurance.insurance;
					
					for(var key in insurance) {
						var coverage = {};
						if(key == "MF") {
							my_flag = insurance[key].selected != '' ? 'Y' : '';
						} else if(key == 'A') {
							coverage.coverageCode = key;
							coverage.insuredAmount = insurance[key].selected != '' ? 'Y' : '';
						} else {
							coverage.coverageCode = key;
							// coverage.insuredAmount = (insurance[key].selected != '') ? (insurance[key].flag.toString() == 'true' ? insurance[key].selected : "") :(insurance[key].flag.toString() == 'true' ? "Y" : "");
							coverage.insuredAmount = (insurance[key].selected != '') ? insurance[key].selected : (insurance[key].flag.toString() == 'true' ? "Y" : "");
						}
						coverage.flag = "";
						console.log(key + "：" + coverage.insuredAmount);
						if(coverage.insuredAmount != "" && key != "MF") {
							if(key == "F") {
								index = data.coverageList.length;
							}
							data.coverageList.push(coverage);
						}
					}
					if(index != undefined) {
						data.coverageList[index].flag = (my_flag == "Y" ? "2" : "1");
					}
					getDetaiByInsurance(data);
				},
				test: function(data, code) {
					if(data == '') {
						if(insuranceVm.insurance.insurance['M' + code]) {
							insuranceVm.insurance.insurance['M' + code].flag = false;
							insuranceVm.insurance.insurance['M' + code].selected = "";
							insuranceVm.insurance.insurance[code].flag = false;
						}
					}
				},
				showDetail: function(data, date1, date2, tax, BXCode, disCount) {
					var insurerDetailData = {};
					insurerDetailData.data = data;
					insurerDetailData.biBeginDate = date1;
					insurerDetailData.ciBeginDate = date2;
					insurerDetailData.carshipTax = tax;
					insurerDetailData.insuranceCode = BXCode;
					insurerDetailData.disCount = disCount;
					var insurerDetail = getDetail(insurerDetailData);
					insuranceDetailVm.insurerDetail = insurerDetail;
					$("#carInfo").hide();
					$("#insuranceDetail").removeClass("hide");
				},
				showInsuranceDefine: function(code) {
					$.getJSON("data/insurance.json", function(data) {
						var content = data[code];
						if(content) {
							$(".modal .content").html(content);
							$(".modal").removeClass("hide");
							$(".mask").removeClass("hide");
						}
					})
				},
				showText: function(el, text) {
					event.stopPropagation();
					$(".text").css({
						"top": $(el).position().top,
						left: $(el).position().left + 11 + "px"
					});
					$(".text span").text(text);
					$(".text").show();
				},
				hideText: function() {
					$(".text").hide();
				},
				changeLable: function(riskCode) {
					if(insuranceVm.insurance.insurance['M' + riskCode].flag.toString() == "true") {
						insuranceVm.insurance.insurance['M' + riskCode].selected = "";
					} else if(insuranceVm.insurance.insurance['M' + riskCode].flag.toString() == "false") {
						insuranceVm.insurance.insurance['M' + riskCode].selected = "Y";
					}
				}
			}
		});

		var YDSF = JSON.parse(localStorage.getItem("YDSF"));
		console.log(YDSF)
		var carInfo = YDSF.carInfo;
		if(carInfo) {
			insuranceVm.carInfo = carInfo;
			var info = carInfo.insurance.data;
			if(info.length > 0) {
				//保额
				var insurance = {};
				insurance.biBeginDate = info[0].quoteResult.biBeginDate;
				insurance.ciBeginDate = info[0].quoteResult.ciBeginDate;
				insurance.insurance = getInsurance(info[0].quoteResult.CoverageList, insurancetypes);
				insurance.default = "";
				insuranceVm.insurance = insurance;
			}
		} else {
			var insurance = {};
			insurance.biBeginDate = "";
			insurance.ciBeginDate = "";
			insurance.insurance = getInsurance(undefined, insurancetypes);
			insurance.default = "";
			insuranceVm.insurance = insurance;
		}
	});

	/**
	 * 重新封装保额数据
	 * @param info
	 * @returns {{}}
	 */
	function getInsurance(info, insurancetypes) {
		var insurance = {};
		for(var i = 0; i < insurancetypes.length; i++) {
			var code = insurancetypes[i].riskCode;
			insurance[code] = {};
			if(code == "FORCEPREMIUM") {
				insurance[code].flag = "true";
				insurance[code].selected = "Y";

			} else {
				insurance[code].flag = false;
				insurance[code].selected = "";
			}
			insurance[code].amount = "";
		}
		insurance["MF"] = {};
		insurance["MF"].flag = false;
		insurance["MF"].selected = "";
		insurance["MF"].amount = "";
		if(info) {
			for(var i = 0; i < info.length; i++) {
				var coverageCode = info[i].coverageCode;
				insurance[coverageCode] = {};
				if(coverageCode == "F") {
					//1.国产2.进口
					if(info[i].flag == 1) {
						insurance['M' + coverageCode].selected = "";
						insurance['M' + coverageCode].flag = false;

					} else if(info[i].flag == 2) {
						insurance['M' + coverageCode].selected = "Y";
						insurance['M' + coverageCode].flag = true;
					}
					insurance['M' + coverageCode].amount = "";
					insurance[coverageCode].selected = (info[i].insuredAmount == "Y") ? "Y" : ((info[i].amount == "") ? "" : info[i].amount);
					insurance[coverageCode].flag = (info[i].insuredAmount == "") ? "false" : "true";
					insurance[coverageCode].amount = info[i].amount;

				} else {

					//if(coverageCode == "A" || coverageCode == "G1" || coverageCode == "Z"){
					// insurance[coverageCode].selected = (info[i].amount != '')?"Y":"";
					//   }else{
					insurance[coverageCode].selected = (info[i].insuredAmount == "Y") ? "Y" : ((info[i].amount == "") ? "" : info[i].amount);
					// insurance[coverageCode].selected = (info[i].amount == "") ? ((info[i].insuredAmount == "") ? "" : "Y"):info[i].amount;
					//  }
					insurance[coverageCode].flag = (info[i].insuredAmount == "") ? false : true;
					insurance[coverageCode].amount = info[i].amount;
				}
			}
		}
		return insurance;
	}

	/**
	 * 重新封装保费数据
	 * @param insurerDetailData
	 * @returns {{}}
	 */
	function getDetail(insurerDetailData) {
		//投保保险费用
		var insurerDetail = {};
		//商业保险起期
		insurerDetail.biBeginDate = insurerDetailData["biBeginDate"];
		insurerDetail.ciBeginDate = insurerDetailData["ciBeginDate"];
		insurerDetail.carshipTax = insurerDetailData["carshipTax"];
		insurerDetail.insuranceCode = insurerDetailData["insuranceCode"];
		insurerDetail.disCount = insurerDetailData["disCount"];

		insurerDetail.insurance = [];
		insurerDetail["FORCEPREMIUM"] = {};
		var total = parseFloat(insurerDetailData["carshipTax"]);
		var data = insurerDetailData.data;
		for(var i = 0; i < data.length; i++) {
			if(data[i].coverageCode == 'FORCEPREMIUM') {
				insurerDetail["FORCEPREMIUM"].amount = data[i].amount;
				insurerDetail["FORCEPREMIUM"].insuredAmount = data[i].insuredAmount;
				insurerDetail["FORCEPREMIUM"].insuredPremium = parseFloat(data[i].insuredPremium);
			} else {
				var insurer = {};
				insurer.coverageCode = data[i].coverageCode;
				insurer.coverageName = data[i].coverageName;
				insurer.amount = data[i].amount;
				insurer.insuredAmount = data[i].insuredAmount == "Y" ? "投保" : (parseInt(data[i].insuredAmount) % 10000 == 0 ? parseInt(data[i].insuredAmount) / 10000 + '万' : data[i].insuredAmount);
				if(data[i].coverageCode == "D3" || data[i].coverageCode == "D4") {
					insurer.insuredAmount = insurer.insuredAmount + "/座";
				} else if(data[i].coverageCode == "F") {
					insurer.insuredAmount = (data[i].flag == 1 ? "国产" : "进口");
				}
				insurer.insuredPremium = parseFloat(data[i].insuredPremium);
				insurerDetail.insurance.push(insurer);
			}
			total += parseFloat(data[i]["insuredPremium"]);
		}
		insurerDetail.total = total.toFixed(2);
		return insurerDetail;
	}

	/**
	 * 重新封装险种类型
	 */
	function getInsuranceTypes(insurancetypes) {
		var newInsuranceTypes = [];
		for(var i = 0; i < insurancetypes.length; i++) {
			var newInsuranceType = {};
			var data = insurancetypes[i];
			newInsuranceType.riskName = data['riskName'];
			newInsuranceType.riskCode = data['riskCode'];
			if(data.insuredAmount != "Y") {
				newInsuranceType.insuredAmount = data['insuredAmount'].split(",");
				newInsuranceType.insuredAmount.unshift("不投保");
			} else {
				// newInsuranceType.insuredAmount =data['insuredAmount'];
				newInsuranceType.insuredAmount = ["投保", "不投保"];
			}
			newInsuranceType.select = "";
			if(data['riskName'].indexOf("不计免赔险") > -1 || data['riskName'].indexOf("交强险") > -1) {
				newInsuranceType.show = false;
			} else {
				newInsuranceType.show = true;
			}
			newInsuranceTypes.push(newInsuranceType);
		}
		return newInsuranceTypes;
	}

	/**
	 * 根据投保选择模拟报价
	 * @param data
	 */
	function getDetaiByInsurance(data) {
		$("body").mLoading(config);
		$.ajax({
			url: ip + "/quote/simulate/update",
			data: JSON.stringify(data),
			type: "post",
			dataType: 'json',
			contentType: 'application/json',
			success: function(data) {
				if(data.code == "0000") {
					$("body").mLoading("hide");
					if(data.data.insurance.code == "0000") {
						insuranceVm.carInfo = data.data;
						var info = data.data.insurance.data;
						if(info.length > 0) {
							//保额
							var insurance = {};
							insurance.biBeginDate = info[0].quoteResult.biBeginDate;
							insurance.ciBeginDate = info[0].quoteResult.ciBeginDate;
							insurance.insurance = getInsurance(info[0].quoteResult.CoverageList, insurancetypes);
							insurance.default = "";
							insuranceVm.insurance = insurance;
						}
						$("#modifyInsurance").addClass("hide");
						$("#carInfo").show();
					} else {
						if(data.data.insurance.msg == "") {
							popInfo("网络异常，请稍后重试");
						} else {
							popInfo(data.data.insurance.msg);
						}
					}
				} else {
					$("body").mLoading("hide");
					popInfo("网络异常，请稍后重试");
				}
			},
			error: function(xhr, textStatus) {
				$("body").mLoading("hide");
				popInfo("网络异常，请稍后重试。");
				console.log('错误');
				console.log(xhr);
				console.log(textStatus);
			}
		});
	}

	$(".close").click(function() {
		$(".modal").addClass("hide");
		$(".mask").addClass("hide");
	});
</script>